# Maintainer: Alexander F Rødseth <xyproto@archlinux.org>
# Contributor: Nathan Baum <n@p12a.org.uk>
# Contributor: Judd Vinet <jvinet@zeroflux.org>
# Contributor: Todd Musall <tmusall@comcast.net>

pkgname=at
pkgver=3.2.5
pkgrel=2
pkgdesc='AT and batch delayed command scheduling utility and daemon'
arch=('loong64' 'x86_64')
url='https://salsa.debian.org/debian/at'
license=('GPL')
depends=('pam' 'flex')
makedepends=('smtp-forwarder' 'git' 'systemd')
backup=('etc/at.deny'
        'etc/pam.d/atd'
        'var/spool/atd/.SEQ')
options=('!makeflags')
validpgpkeys=('464BC7CD439FEE5E8B4098A0348A778D6885EF8F') # Jose M Calhariz (Técnico) <jose.calhariz@tecnico.ulisboa.pt>
source=("http://software.calhariz.com/$pkgname/${pkgname}_${pkgver}.orig.tar.gz"{,.sig}
        '80-atd.hook'
        'pam.conf')
sha256sums=('bb066b389d7c9bb9d84a35738032b85c30cba7d949f758192adc72c9477fd3b8'
            'SKIP'
            'a7048d6dbd8aa4d881979716829d16053b5007c2d83eb2167edd5221f9e48a33'
            '663cd2f7c5abf56d1ea3f38dfac8d3e64896f1384ca5e97b7ec6d26fd6afafef')

build() {
  cd "$pkgname-$pkgver"

  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --with-jobdir=/var/spool/atd \
    --with-atspool=/var/spool/atd \
    --with-systemdsystemunitdir=/usr/lib/systemd/system

  CFLAGS="$CFLAGS -w" make
}

package() {
  make -C "$pkgname-$pkgver" IROOT="$pkgdir" docdir=/usr/share/doc install

  install -D -m0644 pam.conf "$pkgdir"/etc/pam.d/atd
  install -D -m0644 80-atd.hook "$pkgdir"/usr/share/libalpm/hooks/80-atd.hook
}

# vim:set ts=2 sw=2 et:
